<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
  <title>项目经纬度坐标列表</title>
  <meta name="decorator" content="list"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <html:css  name="iCheck,Validform,jquery-ztree,easy-ui"/>
  <html:js  name="iCheck,Validform,jquery-ztree,easy-ui,public-js,common-custom,activiti-js"/>
  <style type="text/css">.row{margin:0;}</style>
  　　<linkrel="stylesheet"href="${staticPath}/../swagger/lang/zh-cn.js"/>
  <%-- <script type="text/javascript" src="${staticPath}/vendors/jquery-select2/select2.min.css"></script> --%>
    <html:css name="bootstrap-fileinput" />
    <html:css name="simditor,jquery-select2" />
    <html:js name="jquery-select2"/>
  <script type="text/javascript" src="${staticPath}/common/js/curdtools_jqgrid_extend.js"></script>
  <script type="text/javascript" src="${staticPath}/modules/activiti/js/workflow.js"></script>

</head>
<body title="项目经纬度坐标">
<div class="easyui-layout" fit="true" id="cc" style="width:100%;">
	<div data-options="region:'center'" title="项目经纬度坐标">
		<grid:grid id="eqProjectCoordinatesGridId" url="${adminPath}/xmgl/eqprojectcoordinates/ajaxList?projectId=${projectId}&projectName=${projectName}" >
			<grid:column label="sys.common.key" hidden="true"   name="id" width="100"/>
			<grid:column label="项目"  name="projectId"  hidden="true" />
			<grid:column label="类型 0:点,非0为线名"  name="type"    />
		    <grid:column label="项目"  name="projectName"    />
		    <grid:column label="经度"  name="longitude" />
		    <grid:column label="纬度"  name="lantitude" />
		    <grid:column label="排序号"  name="sort" />
		    <grid:column label="备注信息"  name="remarks" />
		    
			<grid:toolbar function="expexcel" title="导出模板" icon="fa fa-file-excel-o" btnclass="btn btn-sm btn-fa-fa-file-excel-o" url="${adminPath}/xmgl/eqprojectcoordinates/expexcel" />
			
		    <grid:toolbar onclick="importExcel()"  title="导入" icon="fa fa-file-excel-o" btnclass="btn btn-sm btn-fa-file-excel-o" url="${adminPath}/sys/common/excelUpload"/>
		    
			<shiro:hasPermission name="xmgl:eqprojectcoordinates:create">
				<grid:toolbar function="createE" title="添加"/>
			</shiro:hasPermission>
			<shiro:hasPermission name="xmgl:eqprojectcoordinates:update">
				<grid:toolbar function="update"/>
			</shiro:hasPermission>
			<shiro:hasPermission name="xmgl:eqprojectcoordinates:delete">
				<grid:toolbar function="delete"/>
			</shiro:hasPermission>
			
			<grid:toolbar function="search"/>
			<grid:toolbar function="reset"/>
		</grid:grid>
	</div>
</div>
<script type="text/javascript">


function createE(title,b,gridId,width, height,callBack){
	var projectId='${projectId}';
	var projectName='${projectName}';
    var url= '${adminPath}/xmgl/eqprojectcoordinates/create?projectId='+projectId+'&projectName='+projectName;
    openDialog(title,url,gridId,'80%', '80%',callBack);    

}

	function importExcel(title,b,gridId,width, height,callBack) {
		var projectId='${projectId}';
		if(!projectId){
			top.layer.msg('请先选择项目,再操作!!!', {icon: 0, time: 1000});		
		}
		
		var controllerName = '${adminPath}/xmgl/eqprojectcoordinates/impExcel';
		var url = '${adminPath}/sys/common/excelUpload?nodeId=' + projectId
				+ '&controllerName=' + controllerName; 

		uploadExcel('导入项目经纬度',url,'eqProjectCoordinatesGridIdGrid','50%','50%','callBack');
	}

	function changeID(id){
		id = id.replace("=","~").replace("/","!").replace('+', '.');
		return id;
	}

	function callBack(a, b, c, d, e, f) {
		debugger
	}

	$(function() {
		$("select[name=projectId]").select2({
			language : "zh-CN",
			width : '100%',
			dropdownAutoWidth : true,
			placeholder : '请选择或输入',
			ajax : {
				url : "${adminPath}/sbfb/eqprojectinfo/ajaxList",
				dataType : 'json',
				delay : 300,
				data : function(req, page) {
					return {
						'page.size' : 1000,
						'queryFields' : 'id,name,',
						'query.name||like' : req.term
					};
				},
				processResults : function(data) {
					if (data.results) {
						var my_result = [];
						data.results.forEach(function(item) {
							my_result.push({
								'id' : item.id,
								'text' : item.name
							})
						})
						return {
							results : my_result
						}
					} else {
						console.error("服务端返回异常!!!", data);
					}

				},
				cache : true
			},
			minimumInputLength : 2
		});
	})
</script>
</body>
</html>